-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ISSUE-#4567] Refactor nacos-client Load Logging Configuration code. #4572
Conversation
public static void loadConfiguration(AbstractNacosLogging logging) { | ||
try { | ||
if (logging != null) { | ||
logging.loadConfiguration(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里要不要降级一下,自定义的失败了用默认的。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可行
…e default Logging Load Configuration.
try { | ||
logging.loadConfiguration(); | ||
} catch (Exception e) { | ||
LOGGER.warn("Customize the {} load Configuration fail, message: {}", logging.getClass().getName(), e.getMessage()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LOGGER.warn("Customize the {} load configuration fail, use default log configuration. Message: {}", logging.getClass().getName(), e.getMessage());
*/ | ||
public void loadConfiguration() { | ||
try { | ||
nacosLogging.loadConfiguration(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个变量感觉好绕啊。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里是单例模式+策略模式的实现,对外其实只暴露了这一个方法,内部具体是logback还是log4j2是在初始化的时候决定的。
暂时没有开放完全拓展,主要是两个考虑, 一方面是nacos的日志主要是给运维人员排查用,不希望业务人员随意的改动nacos日志输出的级别和内容,另一方面日志框架其实并不太多,不会频繁扩展,适配起来难度不高。
将来如果需要完全拓展, 初始化加载的时候用个SPI就可以了。
Please do not create a Pull Request without creating an issue first.
What is the purpose of the change
fix: #4567
Brief changelog
XX
Verifying this change
XXXX
Follow this checklist to help us incorporate your contribution quickly and easily:
[ISSUE #123] Fix UnknownException when host config not exist
. Each commit in the pull request should have a meaningful subject line and body.mvn -B clean package apache-rat:check findbugs:findbugs -Dmaven.test.skip=true
to make sure basic checks pass. Runmvn clean install -DskipITs
to make sure unit-test pass. Runmvn clean test-compile failsafe:integration-test
to make sure integration-test pass.